package engine.scene;

public class TriGroupBuffer
{
    
    private static final int MAX_TRI_GROUPS = 50;
    
    
    private int numTriGroupsSent;
    //<editor-fold defaultstate="collapsed" desc="getNumTriGroups">
    public int getNumTriGroups()
    {
        return this.numTriGroupsSent;
    }
        //</editor-fold>
    
    private TriGroup[] triGroups;
    
    public TriGroupBuffer()
    {
        this.triGroups = new TriGroup[TriGroupBuffer.MAX_TRI_GROUPS];
        this.resetIndices();
    }
    
    public void addTriGroup(TriGroup triGroup)
    {
        if (triGroup != null)
        {
            this.triGroups[this.numTriGroupsSent++] = triGroup;
        }
    }
    
    public TriGroup getTriGroupAt(int index)
    {
        return this.triGroups[index];
    }
    
    public void nullifyTriGroupAt(int index)
    {
        this.triGroups[index] = null;
    }
    
    public void clearTriGroups()
    {
        for (int i = 0; i < this.numTriGroupsSent; i++)
        {
            this.nullifyTriGroupAt(i);
        }
        this.resetIndices();
    }
    
    public final void resetIndices()
    {
        this.numTriGroupsSent = 0;
    }
    
    public void destroy()
    {
        this.resetIndices();
        this.triGroups = null;
    }
    
}
